Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

256
Views
Object, object Problem | Using country - city json file compatible with PrimeReact

I am trying to embed country - city json file with PrimeReact. I am having difficulty because of this. I'm pulling the information for the country, but the city shows as [Object, object ].

 <AutoComplete
              placeholder="Search Country"
              dropdown
              value={selectedCountryValue}
              id="dd"
              completeMethod={searchCountry}
              onChange={(e) => setSelectedCountryValue(e.value)}
              suggestions={autoFilteredValue}
              field="name"
              style={{ marginLeft: 10, height: 40, width: 267 }}
            />
 <AutoComplete
              placeholder="Search City"
              dropdown
              value={selectedCountryValue}
              id="dd"
              completeMethod={searchCity(selectedCountryValue)}
              onChange={(e) => setSelectedCountryValue(e.value)}
              suggestions={selectedAutoValueCity}
              field="states"
              style={{ marginLeft: 10, height: 40, width: 267 }}
            />

I used variables. When I select the country, the json other data comes. Console.log also works flawlessly

const searchCity = (event) => {
    setTimeout(() => {
      if (event) {
        console.log("here");
        console.log(event.states.map((obj) => obj.name));
        return event.states.map((obj) => obj.name);
      }
    }, 250);
  };

The Json data sequence is also as shown below.


"data" :[
    {
      "code2": "AF",
      "code3": "AFG",
      "name": "Afghanistan",
      "capital": "Kabul",
      "region": "Asia",
      "subregion": "Southern Asia",
      "states": [
        {
          "code": "BDS",
          "name": "Badakhshān",
          "subdivision": null
        },

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!